package com.TeacherInfoServer.controller;

import com.TeacherInfoServer.common.Result;
import com.TeacherInfoServer.pojo.DTO.AddTemplateFile;
import com.TeacherInfoServer.pojo.DTO.UpdateTemplateFile;
import com.TeacherInfoServer.pojo.query.TemplateFileQuery;
import com.TeacherInfoServer.common.service.TemplateFileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/s1/templateFile")
@Tag(name = "模板文件管理",description = "模板文件管理")
public class TemplateFileController {
    @Autowired
    TemplateFileService templateFileService;

    @Operation(summary = "查询获取粗略信息",description = "查询获取粗略信息")
    @PostMapping("/getListRoughly")
    public Result<?> getListRoughly(@RequestBody TemplateFileQuery templateFileQuery){
        return templateFileService.getListRoughly(templateFileQuery);
    }

    @Operation(summary = "查询获取详细信息",description = "查询获取详细信息")
    @GetMapping("/getDetails")
    public Result<?> getDetails(@RequestParam String id){
        return templateFileService.getDetails(id);
    }
    @Operation(summary = "添加一个模板文件",description = "添加一个模板文件")
    @PostMapping("/addOne")
    public Result addOne(@RequestBody AddTemplateFile addTemplateFile){
        return templateFileService.addOne(addTemplateFile);
    }

    @Operation(summary = "修改一个文件模板",description = "修改一个文件模板")
    @PostMapping("/update")
    public Result update(@RequestBody UpdateTemplateFile updateTemplateFile){
        return templateFileService.update(updateTemplateFile);
    }

    @Operation(summary = "删除模板",description = "删除模板")
    @DeleteMapping("/deleteByIds")
    public Result deleteByIds(@RequestParam("list") List<Integer> list){
        return templateFileService.deleteByIds(list);
    }
}
